﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage/AdminMasterPage.master" AutoEventWireup="true" CodeFile="quan-ly-tinh-thanh.aspx.cs" Inherits="Admin_quan_ly_tinh_thanh" Title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:GridView ID="grvProvince" runat="server" AutoGenerateColumns="False" 
        DataKeyNames="TinhThanhPhoID" onrowcancelingedit="grvProvince_RowCancelingEdit" 
        onrowdeleting="grvProvince_RowDeleting" onrowediting="grvProvince_RowEditing" 
        onrowupdating="grvProvince_RowUpdating">
        <Columns>
            <asp:BoundField DataField="TenTinhThanhPho" HeaderText="Tỉnh Thành" />
            <asp:CommandField ButtonType="Button" HeaderText="Sửa" ShowEditButton="True" />
            <asp:CommandField ButtonType="Button" HeaderText="Xóa" 
                ShowDeleteButton="True" />
        </Columns>
    </asp:GridView>
    <br />
    <h1>Thêm Tỉnh</h1>
    <asp:TextBox ID="txtProvince" runat="server"></asp:TextBox>
    <asp:Button ID="btnAdProvince"
        runat="server" Text="Thêm mới" onclick="btnAdProvince_Click" /><br />
    <br />
    <asp:GridView ID="grvDistrict" runat="server" AutoGenerateColumns="False" 
        DataKeyNames="HuyenQuanID" onrowcancelingedit="grvDistrict_RowCancelingEdit" 
                        onrowdeleting="grvDistrict_RowDeleting" onrowediting="grvDistrict_RowEditing" 
                        onrowupdating="grvDistrict_RowUpdating" 
                        onrowdatabound="grvDistrict_RowDataBound">
        <Columns>
            <asp:TemplateField HeaderText="Huyện Quận">
                <ItemTemplate>
                    <asp:Label ID="lblDistrictName" runat="server" Text='<%# Eval("TenHuyenQuan") %>'></asp:Label></ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox ID="txtDistrictName" runat="server" Text='<%# Eval("TenHuyenQuan") %>'></asp:TextBox></EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Tỉnh Thành">
                <ItemTemplate>
                    <asp:Label ID="lblProvinceName" runat="server" Text='<%# Eval("TenTinhThanhPho") %>'></asp:Label></ItemTemplate>
                    <EditItemTemplate>
                        <asp:DropDownList ID="ddlProvinceName" runat="server">
                        </asp:DropDownList>
                    </EditItemTemplate>
            </asp:TemplateField>
            <asp:CommandField ButtonType="Button" ShowEditButton="True" HeaderText="Sửa" />
            <asp:CommandField ButtonType="Button" ShowDeleteButton="True" 
                HeaderText="Xóa" />
        </Columns>
    </asp:GridView>
    <h1>Thêm Huyện</h1>
    <span>Chọn tỉnh</span><asp:DropDownList ID="ddlProvince" runat="server" AutoPostBack="true" 
        onselectedindexchanged="ddlProvince_SelectedIndexChanged">
    </asp:DropDownList><span>Tên huyện</span><asp:TextBox ID="txtDistrictName" runat="server"></asp:TextBox><asp:Button
        ID="btnAdDistrict" runat="server" Text="Thêm mới" 
        onclick="btnAdDistrict_Click" /><br /><br />
    <asp:GridView ID="grvWard" runat="server" AutoGenerateColumns="False" 
        onrowcancelingedit="grvWard_RowCancelingEdit" 
        onrowdatabound="grvWard_RowDataBound" onrowdeleting="grvWard_RowDeleting" 
        onrowediting="grvWard_RowEditing" onrowupdating="grvWard_RowUpdating">
        <Columns>
            <asp:TemplateField HeaderText="Phường Xã">
                <ItemTemplate>
                    <asp:Label ID="lblWardName" runat="server" Text='<%# Eval("TenXaPhuong") %>'></asp:Label></ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="txtWardName" runat="server"></asp:TextBox></EditItemTemplate>    
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Quận Huyện">
                <ItemTemplate>
                    <asp:Label ID="lblDistrictName" runat="server" Text='<%# Eval("TenHuyenQuan") %>'></asp:Label></ItemTemplate>
                    <EditItemTemplate>
                        <asp:DropDownList ID="ddlDistrict" runat="server">
                        </asp:DropDownList>
                    </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Tỉnh Thành">
                <ItemTemplate>
                    <asp:Label ID="lblProvinceName" runat="server" Text='<%# Eval("TenTinhThanhPho") %>'></asp:Label></ItemTemplate>
                    <EditItemTemplate>
                        <asp:DropDownList ID="ddlProvinceName" runat="server">
                        </asp:DropDownList>
                    </EditItemTemplate>
            </asp:TemplateField>
            <asp:CommandField ButtonType="Button" HeaderText="Sửa" ShowEditButton="True" />
            <asp:CommandField ButtonType="Button" HeaderText="Xóa" 
                ShowDeleteButton="True" />
        </Columns>
    </asp:GridView>
    <br /><h1>Thêm Xã Phường</h1>
    <span>Tên xã phường</span><asp:TextBox ID="txtWardName" runat="server"></asp:TextBox><span>Huyện quận</span><asp:DropDownList
        ID="ddlDistrict" runat="server">
    </asp:DropDownList><span>Tỉnh thành</span><asp:DropDownList ID="ddlProvince1" 
        runat="server" onselectedindexchanged="ddlProvince1_SelectedIndexChanged" 
        AutoPostBack="True">
    </asp:DropDownList>
    <asp:Button ID="btnAddWard" runat="server" Text="Thêm Xã" 
        onclick="btnAddWard_Click" />
</asp:Content>

